﻿
@{
    ViewBag.Title = "重置密码 - 果壳园";
    Layout = "~/Areas/Admin/Views/Shared/_AccountLayout.cshtml";
}
@model Nutshell.Blog.Model.ViewModel.ResetPwd
<h2 class="title">重置密码</h2>
<div>
    @using (Ajax.BeginForm("ResetPassword", new AjaxOptions { HttpMethod = "POST", OnBegin = "btn_loading('验证中')", OnSuccess = "success", OnFailure = "btn_loaded('提交')" }))
    {
        <input type="hidden" value="@ViewBag.Active" name="active" />
        <div class="ctrl-group">
            @Html.LabelFor(m => m.Password)
            <div>
                @Html.PasswordFor(m => m.Password)
            </div>
            @Html.ValidationMessageFor(m => m.Password, null, new { @class = "error" })
        </div>
        <div class="ctrl-group">
            @Html.LabelFor(m => m.Repassword)
            <div>
                @Html.PasswordFor(m => m.Repassword)
            </div>
            @Html.ValidationMessageFor(m => m.Repassword, null, new { @class = "error" })
        </div>
        <div class="ctrl-group">
            @Html.LabelFor(m => m.Code)
            <div id="code_box">
                @Html.TextBoxFor(m => m.Code, new { id = "txtCode" })
            </div>
            @Html.ValidationMessageFor(m => m.Code, null, new { @class = "error" })
            <img id="img_code" title="点击更换验证码" src="/account/getValidCode" alt="验证码加载失败" onclick="changecode()" />
        </div>
        <div class="ctrl-btns">
            <input type="submit" id="btnSubmit" value="提交" class="btn-submit" />
        </div>
    }
</div>
@section script{
    <script>
        function success(data) {
            btn_loaded('提交');
            alert(data.msg);
            if (data.code == 0) {
                location = "/account/signin";
            } else {
                changecode();
            }
        }
    </script>
}